fuzzyhash-rs
Pure Rust fuzzy hash implementation.
Usage
Hash A File
use FuzzyHash;
let fuzzy = file.unwrap;
// `FuzzyHash` implements `Display` so this works:
println!;
Hash Data
use FuzzyHash;
// Anything that implements `AsRef<[u8]>` can be immediately hashed
let data = vec!;
let fuzzy = new;
Anything that implements std::io::Read
use FuzzyHash;
use ;
let mut cursor = new;
let fuzzy = read;
Build a fuzzy hash from blocks of data manually
use FuzzyHash;
use Read;
let mut file = open.unwrap;
let mut fuzzy_hash = default;
loop
fuzzy_hash.finalize;
println!;
FFI Compatibility Two functions provide entry points for FFI usage of this library.
// hashing some data
unsigned char *data = ;
// fill this buffer...
int fuzzy = ;
// compare two fuzzyhashes
char *first = "96:U57GjXnLt9co6pZwvLhJluvrszNgMFwO6MFG8SvkpjTWf:Hj3BeoEcNJ0TspgIG8SvkpjTg";
char *second = "96:U57GjXnLt9co6pZwvLhJluvrs1eRTxYARdEallia:Hj3BeoEcNJ0TsI9xYeia3R";
int compared = ;
Status
Currently this library only supports the None
mode of the ssdeep fuzzy hashing algorithm,
EliminateSequences
and DoNotTruncate
will be implemented eventually.
Run the example
$ cargo run -q --example example1 /bin/bash
24576:z0wp2rLW2W2iYQK+q/VjsFEDe866QHX4kC:rp2rLW2W2iYJ+FEg6QHX
0.2.0 API Changes
The public API for the library has been largely re-imagined and is full of breaking changes.
0.1.3 Updates
Fixed performance bottlenecks with cloning large buffers unnecessarily (~22% faster).
1000 iterations of large random buffer
0.1.2:
; ; ; ;
)
; ; ; ;
)
vs
0.1.3:
; ; ; ;
)
; ; ; ;
)
Acknowledgements
I previously ported the algorithm to C++ and couldn't find a version in Rust, so here we are! I definitely need to mention kolos450's work porting the algorithm to C#, which was a great jumping off point for both of my implementations.